#include "QueueSchedule.h"


void QueueSchedule::AddTask(TThreadSafeSharedPtr<CTaskBase> InTask)
{
    std::lock_guard<std::mutex> Locker(WaitingTasksLocker);
    WaitingTasks.push(InTask);
    InTask->State.store(CTaskBase::EState::WaitingInSchedule);
}

bool QueueSchedule::HasTasks()
{
    std::lock_guard<std::mutex> Locker(WaitingTasksLocker);
    return !WaitingTasks.empty();
}

void QueueSchedule::Shutdown()
{
    std::lock_guard<std::mutex> Locker(WaitingTasksLocker);
    while(!WaitingTasks.empty())
    {
        WaitingTasks.pop();
    }
}
